<?php
namespace app\ad\controller;
use framework\ext\Check;
/* *
 * 广告转向
 * */
class UrlController extends \app\base\controller\IndexController{

    public function index(){
        $id = form('get.ad',0,intval);
        $rel =  model('adlook')->_find(array('id'=>$id));
        if($rel){
            model('adlook')->_update(array('views'=>$rel['views']+1),array('id'=>$id));
            $this->redirect($rel['url']);    
        }else{
            $this->pageError('广告未设置,请返回刷新重新打开');
        }
    }
    
}